﻿using System.Web.UI;
using System.Web.UI.HtmlControls;

namespace CodeContrib.Web.WebControls
{
	public class ActionlessForm : HtmlForm
	{
		protected override void RenderAttributes(HtmlTextWriter writer)
		{
			if (!string.IsNullOrEmpty(ID))
			{
				writer.WriteAttribute("id", ID);
			}

			writer.WriteAttribute("name", Name);
			writer.WriteAttribute("method", Method);

			Attributes.Remove("action");

			writer.WriteAttribute("onsubmit", "javascript:return WebForm_OnSubmit();");
			Attributes.Remove("onsubmit");

			Attributes.Render(writer);
		}
	}
}